package com.linwen.excise.leetcode;

/**
 * @ClassName _1486数组异或操作
 * @Description TODO
 * @Author zero
 * @DATE 2024/9/22 1:31 AM
 * @Version 1.0
 */
public class _1486数组异或操作 {
    public static void main(String[] args) {
        _1486数组异或操作 inst = new _1486数组异或操作();
        System.out.println(inst.xorOperation(5, 0));
    }

    public int xorOperation(int n, int start) {
        int result = start;
        for (int i = 1; i < n; i++) {
            result = (start + 2 * i) ^ result;
        }
        return result;
    }
}
